Quick Start
Launch terminal
In this short tutorial, you can try Towhee for yourself in this browser-based scenario. To begin, click the "Launch Terminal" button below.
Clicking on any of the code snippets below will automatically paste the contents of the snippet into the terminal you just launched. Once you close this page, the environment that you just spun up along with all of its contents will be wiped clean.
Install Towhee
The browser-based terminal you just brought up is a completely clean environment, so we'll need to install Towhee first: (click the following command, it will be copied into the terminal)
First, install Towhee:
pip3 install towhee
If you want to install models in towhee, just run:
pip3 install towhee.models
Running your first pipeline
Now it's time to generate your first embedding with Towhee! Open up a python
terminal:
python3
Data transformations are central to Towhee; Pipelines are simply a series of transformations connected together in a directed acyclic graph. All pre-built Towhee pipelines are given names that are representative of the task at hand. To create a pipeline, import the AutoPipes
function from towhee
:
from towhee import AutoPipes
Now let's instantiate a sentence embedding pipeline:
p = AutoPipes.pipeline('sentence_embedding')
Then run the pipeline:
output = p('Hello World.').get()
That's it! The embedding vector for the corresponding input sentence is stored in the output
variable:
print(output)
Cleaning up
Once you're finished, be sure to quit out of the environment using:
quit()
Learn more
A list of all the operators we provide can be found here. As always, if you have any questions or comments, feel free to get in touch with us via Slack.